/* javascript for templates/views_user_admin/list.html */

function del_user(user_id)
{
    if (!confirm("确定删除此用户?"))
        return false;
        
    var req = new Chujue_Request();
    req.url = "/admin/del-user";
    req.send_data = { "user_id": user_id };
    req.ok_func = function(data) {
        user_id = data.user_id;
        //  从table中找出 id == user_id 的行, 然后从页面上删除这行
        for (var i=0; i < $(".table > tbody > tr").length; i++) {
            // alert($(".table > tbody > tr:eq("+i+") > td:eq(0) >a").text());
            if (user_id == $(".table > tbody > tr:eq("+i+") > td:eq(0)>a").text()) {
                $(".table > tbody > tr:eq("+i+")").remove();
                break;
            }
        }
    };
    req.ajax_req();
}


